package func.study.jvm.c3;

import java.util.ArrayList;
import java.util.List;

/**
 * 使用jconsole监控
 * Created by chenyao on 2017/7/10.
 */
public class MonitoringTest {


    static class OOMObject {
        private byte[] placeholder = new byte[64 * 1024];
    }

    public static void fillHeap(int num) throws InterruptedException {
        List<OOMObject> list = new ArrayList<>();
        for(int i = 0; i < num; i++) {
            //延时，让监视曲线更明显
            Thread.sleep(50);
            list.add(new OOMObject());
        }
        System.gc();

    }
    public static void main(String[] args) throws InterruptedException {
        fillHeap(1000);
    }

}
